package day1108_2;

import java.io.*;

class Student implements  Serializable{
    String name;
    int   age;
}

public class Z2 {
    public static void main(String[] args) throws IOException {
        ObjectOutputStream  oos=new ObjectOutputStream(
                new FileOutputStream("1108obj.dat") );//1.

        Student gy=new Student();  gy.name="郭羽";  gy.age=20;
        oos.writeObject(gy);  //2.把对象保存到1108obj.dat

        oos.close();//3.调用 ObjectOutputStream  oos对象的close关闭对象输出流
        //(释放1108obj.dat文件<解除占用>)
    }
}









